1. Field of the Invention
This invention relates to an encoding apparatus and method. More particularly, the invention relates to an encoding apparatus and method for performing variable-length coding.
2. Description of the Related Art
Huffman coding is widely known as a data compression method using variable-length coding. With Huffman coding, short code words are allocated, in accordance with the probability distribution of a symbol, in the order of symbol probability, thereby shortening average code length.
A problem encountered with this technique is that since code words are assigned in accordance with the probability distribution of a symbol, coding efficiency declines if there is a change in the symbol probability distribution. In order to overcome this drawback, dynamic Huffman coding has been proposed in literature such as "D. Knuth, "Dynamic Huffman Coding", Journal of Algorithm, Vol. 6, No. 2, pp. 163.about.180, June, 1985". However, according to dynamic Huffman coding, Huffman codes are reconstructed by computing an occurrence probability whenever a code is entered. As a consequence, a large amount of hardware (or computation) is required.